<template>
  <div class="categories-view">
    <!-- 页面头部 -->
    <div class="page-header">
      <div class="container">
        <h1>🍜 美食分类</h1>
        <p>发现您喜爱的美食类型，探索不同风味</p>
      </div>
    </div>
    
    <div class="container">
      <div class="categories-grid grid grid-4">
        <div v-for="category in categories" :key="category.id" class="category-card" @click="goToCategory(category.id)">
          <div class="category-icon">{{ category.icon }}</div>
          <div class="category-info">
            <h3>{{ category.name }}</h3>
            <p class="description">{{ category.description }}</p>
            <div class="category-count">{{ category.count }}+ 道菜品</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'CategoriesView',
  data() {
    return {
      categories: [
        { id: 1, name: '川菜', count: 3, icon: '🌶️', description: '四川菜系，以麻辣鲜香著称' },
        { id: 2, name: '粤菜', count: 2, icon: '🦐', description: '广东菜系，清淡鲜美' },
        { id: 3, name: '湘菜', count: 0, icon: '🥘', description: '湖南菜系，香辣可口' },
        { id: 4, name: '鲁菜', count: 0, icon: '🐟', description: '山东菜系，口味醇厚' },
        { id: 5, name: '江浙菜', count: 0, icon: '🦀', description: '江浙菜系，清香甜美' },
        { id: 6, name: '西餐', count: 0, icon: '🍕', description: '西式料理，异域风情' },
        { id: 7, name: '日韩料理', count: 0, icon: '🍣', description: '日韩风味，精致美味' },
        { id: 8, name: '东南亚菜', count: 0, icon: '🍜', description: '东南亚风味，酸辣开胃' }
      ]
    }
  },
  methods: {
    goToCategory(categoryId) {
      this.$router.push(`/category/${categoryId}`)
    }
  }
}
</script>

<style scoped>
.categories-view {
  min-height: 100vh;
}

.categories-grid {
  padding: var(--spacing-lg) 0;
}

.category-card {
  background: var(--background-primary);
  padding: 20px;
  border-radius: var(--radius-xl);
  text-align: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border: 2px solid var(--border-light);
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: var(--gradient-primary);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 1;
}

.category-card:hover::before {
  left: 0;
  opacity: 0.1;
}

.category-card:hover {
  transform: translateY(-8px) scale(1.02);
  border-color: var(--primary-color);
  box-shadow: var(--shadow-xl);
}

.category-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
  position: relative;
  z-index: 2;
  transition: transform 0.3s ease;
}

.category-card:hover .category-icon {
  transform: scale(1.05);
}

.category-info {
  position: relative;
  z-index: 2;
}

.category-info h3 {
  color: var(--text-primary);
  margin-bottom: 8px;
  font-size: 1.2rem;
  font-weight: 600;
}

.description {
  color: var(--text-secondary);
  margin-bottom: 12px;
  line-height: 1.4;
  font-size: 0.85rem;
}

.category-count {
  background: var(--gradient-secondary);
  color: white;
  padding: 6px 12px;
  border-radius: var(--radius-xl);
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-block;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .category-card {
    padding: 16px;
  }
  
  .category-icon {
    font-size: 2.2rem;
    margin-bottom: 10px;
  }
  
  .category-info h3 {
    font-size: 1.1rem;
  }
  
  .description {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .category-card {
    padding: 12px;
  }
  
  .category-icon {
    font-size: 2rem;
  }
  
  .category-info h3 {
    font-size: 1rem;
  }
}
</style> 